﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:WinChrome="clr-namespace:WinChrome" 
    xmlns:Convertors="clr-namespace:WinChrome.Convertors" 
    xmlns:UI="clr-namespace:WinChrome.UI"
    xmlns:shell="http://schemas.microsoft.com/winfx/2006/xaml/presentation/shell"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d">

    <ResourceDictionary.MergedDictionaries>
        <!--<ResourceDictionary Source="/WinChrome;component/UI/GlassResourceDictionary.xaml" />-->
        <ResourceDictionary Source="/WinChrome;component/UI/VS2012ResourceDictionary.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <!-- Custom NavigationWindow UI -->
    <Style x:Key="VS2012Window" TargetType="{x:Type Window}">
        <Setter Property="AllowsTransparency" Value="True"/>
        <Setter Property="WindowStyle" Value="None"/>
        <Setter Property="MinWidth" Value="400"/>
        <Setter Property="WinChrome:VS2012.GlowColor" Value="{DynamicResource {x:Static SystemColors.HotTrackColorKey }}"/>
        <Setter Property="WinChrome:VS2012.ChromeContent" Value="{x:Null}"/>
        <Setter Property="shell:WindowChrome.WindowChrome">
            <Setter.Value>
                <shell:WindowChrome 
                    ResizeBorderThickness="4"
                    CaptionHeight="24"
                    CornerRadius="0"
                    GlassFrameThickness="0"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Window">
                    <Border x:Name="WindowGlowBorder" Style="{StaticResource GlowBorder}" WinChrome:VS2012.GlowBorder="True">
                        <Grid x:Name="ActualWindowRender" Background="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" >
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Grid x:Name="NonClientUI" >
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Image Source="{TemplateBinding Property=Window.Icon}" MinHeight="32" MinWidth="32"/>
                                <TextBlock Text="{TemplateBinding Title}" Foreground="Gray" Margin="3" FontSize="15" FontFamily="Segoe UI"
                                                               Grid.Column="1" VerticalAlignment="Center"/>
                                <ContentControl Grid.Column="2" Margin="1"
                                                                Content="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=(WinChrome:VS2012.ChromeContent)}" />
                                <Grid Grid.Column="3" VerticalAlignment="Stretch" Margin="0,0,0,2"
                                            		Width="{Binding WindowCaptionButtonsLocation.Width, Source={x:Static shell:SystemParameters2.Current}}">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition/>
                                        <ColumnDefinition/>
                                        <ColumnDefinition/>
                                    </Grid.ColumnDefinitions>
                                    <!-- Style="{DynamicResource InGlassSearchBoxStyle}"-->
                                    <Button Content="Minimize" Grid.Column="0"
                                            			Command="{x:Static shell:SystemCommands.MinimizeWindowCommand}" 
                                            			shell:WindowChrome.IsHitTestVisibleInChrome="True" Style="{DynamicResource MinimizeButtonStyle}">
                                    </Button>
                                    <Button Content="Maximize" 
                                            			Grid.Column="1" Visibility="{TemplateBinding Converter={StaticResource windowStateCannotMaximize}, Property=Window.WindowState}"
                                            			Command="{x:Static shell:SystemCommands.MaximizeWindowCommand}" 
                                            			shell:WindowChrome.IsHitTestVisibleInChrome="True" Style="{DynamicResource MaxButtonStyle}" />
                                    <Button Content="Restore" 
                                            			Grid.Column="1"  Visibility="{TemplateBinding Converter={StaticResource windowStateCanMaximize}, Property=Window.WindowState}"
                                            			Command="{x:Static shell:SystemCommands.RestoreWindowCommand}" 
                                            			shell:WindowChrome.IsHitTestVisibleInChrome="True" Style="{DynamicResource RestoreButtonStyle}" />
                                    <Button Grid.Column="2" Content="Close"
                                            			Command="{x:Static shell:SystemCommands.CloseWindowCommand}" 
                                            			shell:WindowChrome.IsHitTestVisibleInChrome="True" Style="{DynamicResource CloseButtonStyle}"/>
                                    <!-- Margin="{Binding Source={x:Static shell:SystemParameters2.Current}, Path=WindowCaptionButtonsLocation, Converter={StaticResource CaptionButtonMarginConverter}}" -->
                                </Grid>
                            </Grid>

                            <Border Grid.Row="1" Margin="6,0,6,6"
                                                        BorderBrush="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" 
                                                        BorderThickness="1"
                                                        Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
                                <Grid >
                                    <ScrollViewer VerticalScrollBarVisibility="Auto" >
                                        <ContentPresenter 
                                                        	    Content="{TemplateBinding ContentControl.Content}" 
                                                        	    ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" 
                                                        	    ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
                                                        	    x:Name="PART_NavWinCP" ClipToBounds="True" />
                                    </ScrollViewer>
                                    <ContentPresenter 
                                                            Content="{Binding GlobalContent, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type WinChrome:SearchableNavigationWindow}}}"/>
                                </Grid>
                            </Border>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsFocused" Value="False"/>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <!-- Initial NavigationWindow dimensions -->
        <!-- <Setter Property="Width" Value="400" />
        <Setter Property="Height" Value="300" />-->

    </Style>
</ResourceDictionary>